package _05SingleTonDesignPattern;

/**
 * 懒汉式
 */
public class Person1 {
    private String name;
    private static Person1 person;
    private Person1(){

    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public static synchronized Person1 getPerson(){
       if(person==null){
           person=new Person1();
       }
       return person;
    }
}
